/* ==================================================================   
 * Created [2009-4-27 下午11:32:55] by Jon.King 
 * ==================================================================  
 * TSS 
 * ================================================================== 
 * mailTo:jinpujun@hotmail.com
 * Copyright (c) Jon.King, 2009-2012 
 * ================================================================== 
*/

package com.jinhe.tss.core.cachepool;

import java.util.EventObject;


/** 
 * <p> ObjectPoolEvent.java </p> 
 * 
 * 对象池事件
 * 
 * @author Jon.King 2006-12-28
 */
public class ObjectPoolEvent extends EventObject{
    
    private static final long serialVersionUID = -1574889170922509995L;
    
    public static final int CHECKOUT = 1;
    public static final int CHECKIN = 2;
    public static final int MAX_POOL_LIMIT_REACHED = 3;
    public static final int MAX_POOL_LIMIT_EXCEEDED = 4;
    public static final int POOL_RELEASED = 5;
    public static final int PUT_IN = 6;
    public static final int REMOVE = 7;
    
    public static final int STRATEGY_CHANGED_NORMAL = 8;
    public static final int STRATEGY_CHANGED_INITNUM_RISE = 9;
    public static final int STRATEGY_CHANGED_SIZE_REDUCE = 10;
    public static final int STRATEGY_CHANGED_RESET = 11;

    private int type;

    public ObjectPoolEvent(IPool pool, int type){
        super(pool);
        this.type = type;
    }

    /**
     * 返回创建该事件的池
     */
    public IPool getPool() {
        return (IPool)getSource(); 
    }

    public int getType() { return type; }
}

